//玩家拥有的英雄

import { MapWrap } from "../../../Core/FrameEx/ES5Ex";
import { GLocal } from "../../../Core/Manager/DataPool";


const { ccclass } = cc._decorator;
@ccclass
export default class LHeroData extends GLocal {
	public $localKey = "LHeroData";
	private $ownHeros: IHeroData[] = [];
	private _needAutoSave: boolean = false;

	public getAllHeros(): IHeroData[] {
		return this.$ownHeros;
	}

	public onInit() {
		this.load();
	}

	public save(mapData: MapWrap<StringOrNumber, IHeroData>) {
		this.$ownHeros = [];
		mapData.values<IHeroData>().forEach(value => {
			this.$ownHeros.push(value);
		})
		this.set();
	}
}